package com.guomao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;


@WebServlet("/sessiondemo1")
public class SessionServletDemoA extends HttpServlet {


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


//        HttpSession session = req.getSession();
//
//        System.out.println(session.isNew());

//        class org.apache.catalina.session.StandardSessionFacade
//        System.out.println(req.getSession().getClass());


        HttpSession session = req.getSession();
        System.out.println(session.isNew());

//        session.setAttribute("sessiondemo", "abcde");
//        req.setAttribute("sessiondemo", "abcde");

//        session.invalidate();
//        System.out.println(session.getAttribute("sessiondemo"));
//        req.getRequestDispatcher("sessiondemo2").forward(req, resp);
    }
}
